import settings
import logging

class Log(object):
    def __init__(self, name):
        self.logger = logging.getLogger(name)
    
    def debug(self, msg, *args, **kwargs):
        if settings.LOG_ON:
            self.logger.debug(msg, *args, **kwargs)
            
    def info(self, msg, *args, **kwargs):
        if settings.LOG_ON:
            self.logger.info(msg, *args, **kwargs)
            print msg
            
    def warning(self, msg, *args, **kwargs):
        if settings.LOG_ON:
            self.logger.warning(msg, *args, **kwargs)
            
    def error(self, msg, *args, **kwargs):
        if settings.LOG_ON:
            self.logger.error(msg, *args, **kwargs)
            
    def critical(self, msg, *args, **kwargs):
        if settings.LOG_ON:
            self.logger.critical(msg, *args, **kwargs)            